package dgo.tilemap;
import dgo.Geometry.Rectangle;
import starruby.Texture;

public class CharacterChipset {
      public byte sizeX, sizeY;
      public byte animationFrameNumber, defaultFrameNo, dirNumber;
      public Rectangle hitRect;
      public String name;
      private Texture _texture;
      public CharacterChipset(String name, Texture texture, int sizeX, int sizeY, int animationFrameNumber, int dirNumber){
        this.sizeX = (byte)sizeX;
        this.sizeY = (byte)sizeY;
        this.animationFrameNumber = (byte)animationFrameNumber;
        this.dirNumber = (byte)dirNumber;
        this.defaultFrameNo = 1;
        this.name = name;
        _texture = texture;
      }

      public int width(){
        return _texture.getWidth();
      }
      
      public int height(){
        return _texture.getWidth();
      }
      
      public void render(Texture s, int x, int y, int sx, int sy, byte frameNo, byte dir){
        if(_texture == null)return;
        s.renderTexture(
          _texture, x, y, 
          (sx * animationFrameNumber + frameNo) * sizeX, 
          (sy * dirNumber + dir) * sizeY, sizeX, sizeY
          );
      }
}
